/*	******************************************
	File:		StateManager.cpp
	Author:		Adnan Srna, Peter Kober, Ivo Havranek
	Purpose:	AugmentedReality 2
	(up)Date:	March/April 2010
	Descr.:		This one is kept stupid and just
				handles the switching the state(s)
	Origin:		Salzburg University of Applied Science
	******************************************	*/

#include "StateManager.h"
#include "State.h"
#include "StateSoundTest.h"
#include "StateVideoTest.h"
#include "StateGame.h"
#include "StateGameOver.h"

StateManager::StateManager(){
	_currentState = NULL;
	changeState(new StateSoundTest());
}

void StateManager::draw(){
	_currentState->draw();
}

void StateManager::update(){
	_currentState->update();
}

void StateManager::changeState(State* state)
{
	if(state != _currentState){
		if(_currentState != NULL){
			delete _currentState;
		}
		_currentState = state;
		_currentState->setup(this);
	}
}
